home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Complete Linux
/
Complete Linux.iso
/
xwindows
/
demos
/
xfract_1.z
/
xfract_1
/
xfractint-1.06
/
miscovl.c
< prev
next >
Wrap
C/C++ Source or Header
|
1992-09-28
|
34KB
|
1,193 lines
/*
Overlayed odds and ends that don't fit anywhere else.
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#ifndef XFRACT
#include <process.h>
#include <dos.h>
#include <stdarg.h>
#include <io.h>
#else
#include <varargs.h>
#endif
#include "fractint.h"
#include "fractype.h"
#include "helpdefs.h"
#include "prototyp.h"
/* routines in this module */
static void write_batch_parms(FILE *,char *,int);
#ifndef XFRACT
static void put_parm(char *parm,...);
#else
static void put_parm();
#endif
static void put_parm_line(void);
static int getprec(double,double,double);
static void put_float(int,double,int);
static void put_filename(char *keyword,char *fname);
static void format_item(int choice,char *buf);
static int check_modekey(int curkey,int choice);
static int entcompare(VOIDCONSTPTR p1,VOIDCONSTPTR p2);
static void update_fractint_cfg(void);
extern int cpu; /* cpu type */
extern int fpu; /* fpu type */
extern int iit; /* iit fpu? */
extern int video_type;
extern int askvideo;
extern char overwrite; /* 1 means ok to overwrite */
extern int fillcolor; /* fill color: -1 = normal*/
extern int inside; /* inside color: 1=blue */
extern int outside; /* outside color, if set */
extern double xxmin,xxmax,yymin,yymax,xx3rd,yy3rd; /* selected screen corners */
extern double param[4]; /* up to four parameters */
extern int finattract; /* finite attractor option */
extern int forcesymmetry;
extern int LogFlag; /* non-zero if logarithmic palettes */
extern int rflag, rseed;
extern int periodicitycheck;
extern int potflag; /* continuous potential flag */
extern int pot16bit; /* save 16 bit values for continuous potential */
extern double potparam[3]; /* three potential parameters*/
extern int fractype; /* if == 0, use Mandelbrot */
extern BYTE usemag;
extern long delmin;
extern int maxit; /* try this many iterations */
extern int invert; /* non-zero if inversion active */
extern double inversion[];
extern int decomp[];
extern int distest; /* non-zero if distance estimator */
extern int distestwidth;
extern int init3d[20]; /* '3d=nn/nn/nn/...' values */
extern char floatflag; /* floating-point fractals? */
extern int usr_biomorph;
extern char FormFileName[]; /* file to find (type=)formulas in */
extern char FormName[]; /* Name of the Formula (if not null) */
extern char LFileName[];
extern char LName[];
extern char IFSFileName[];
extern char IFSName[];
extern int bailout; /* user input bailout value */
extern char useinitorbit;
extern struct complex initorbit;
extern int display3d; /* 3D display flag: 0 = OFF */
extern int loaded3d;
extern char readname[]; /* name of fractal input file */
extern int showfile; /* has file been displayed yet? */
extern int transparent[];
extern char preview; /* 3D preview mode flag */
extern char showbox; /* flag to show box and vector in preview */
extern int RANDOMIZE; /* Color randomizing factor */
extern int Targa_Out; /* Selects full color with light source fills */
extern int Ambient; /* Darkness of shadows in light source */
extern int haze; /* Amount of haze to factor in in full color */
extern char light_name[]; /* Name of full color .TGA file */
extern int previewfactor;
extern int BRIEF;
extern int RAY;
extern int xtrans;
extern int ytrans;
extern int red_crop_left;
extern int red_crop_right;
extern int blue_crop_left;
extern int blue_crop_right;
extern int red_bright;
extern int blue_bright;
extern int xadjust;
extern int eyeseparation;
extern int glassestype;
extern BYTE trigndx[];
extern int rotate_lo,rotate_hi;
extern int far *ranges;
extern int rangeslen;
extern char CommandFile[80];
extern char CommandName[ITEMNAMELEN+1];
extern char CommandComment1[57];
extern char CommandComment2[57];
extern char usr_stdcalcmode;
extern int colorstate; /* comments in cmdfiles */
extern int colors;
extern int gotrealdac;
extern int reallyega;
extern char colorfile[];
extern int mapset;
extern char MAP_name[];
extern BYTE dacbox[256][3];
extern char far *mapdacbox;
extern char tstack[4096];
extern char s_cantopen[];
extern char s_cantwrite[];
extern char s_cantcreate[];
extern char s_cantunderstand[];
extern char s_cantfind[];
/* fullscreen_choice options */
#define CHOICERETURNKEY 1
#define CHOICEMENU 2
#define CHOICEHELP 4
int fullscreen_choice(
int options, char *hdg, char *hdg2, char *instr, int numchoices,
char **choices, int *attributes, int boxwidth, int boxdepth,
int colwidth, int current, void (*formatitem)(),
char *speedstring, int (*speedprompt)(), int (*checkkey)());
void miscovl_overlay() { } /* for restore_active_ovly */
extern char s_real[];
extern char s_imag[];
extern char s_mult[];
extern char s_sum[];
extern char s_zmag[];
extern char s_bof60[];
extern char s_bof61[];
extern char s_maxiter[];
static FILE *parmfile;
#ifdef C6
#pragma optimize("e",off) /* MSC 6.00A messes up next rtn with "e" on */
#endif
void make_batch_file()
{
int i,numparms;
char inpcommandfile[80],inpcommandname[ITEMNAMELEN+1];
char inpcomment1[57],inpcomment2[57];
struct fullscreenvalues paramvalues[8];
char far *choices[8];
int gotinfile;
char outname[81],buf[256],buf2[128];
FILE *infile;
char colorspec[14];
int maxcolor;
char *sptr,*sptr2;
int oldhelpmode;
ENTER_OVLY(OVLY_MISCOVL);
stackscreen();
oldhelpmode = helpmode;
helpmode = HELPPARMFILE;
strcpy(colorspec,"n");
maxcolor = colors;
if (gotrealdac && !reallyega) {
--maxcolor;
if (maxit < maxcolor) maxcolor = maxit;
if (inside > 0 && inside > maxcolor) maxcolor = inside;
if (outside > 0 && outside > maxcolor) maxcolor = outside;
if (distest < 0 && 0-distest > maxcolor) maxcolor = 0-distest;
if (decomp[0] > maxcolor) maxcolor = decomp[0] - 1;
if (potflag && potparam[0] >= maxcolor) maxcolor = potparam[0];
if (++maxcolor > 256) maxcolor = 256;
if (colorstate == 0) { /* default colors */
if (mapdacbox) {
colorspec[0] = '@';
sptr = MAP_name;
}
}
else if (colorstate == 2) { /* colors match colorfile */
colorspec[0] = '@';
sptr = colorfile;
}
else /* colors match no .map that we know of */
colorspec[0] = 'y';
if (colorspec[0] == '@') {
if ((sptr2 = strrchr(sptr,SLASHC))) sptr = sptr2 + 1;
if ((sptr2 = strrchr(sptr,':'))) sptr = sptr2 + 1;
strncpy(&colorspec[1],sptr,12);
colorspec[13] = 0;
}
}
strcpy(inpcommandfile,CommandFile);
strcpy(inpcommandname,CommandName);
strcpy(inpcomment1,CommandComment1);
strcpy(inpcomment2,CommandComment2);
if (CommandName[0] == 0)
strcpy(inpcommandname,"test");
while (1) {
prompt_user:
{
static char far tmp[] = {"Parameter file"};
choices[0] = tmp;
}
paramvalues[0].type = 0x100+56;
paramvalues[0].uval.sbuf = inpcommandfile;
{
static char far tmp[] = {"Name"};
choices[1] = tmp;
}
paramvalues[1].type = 0x100+ITEMNAMELEN;
paramvalues[1].uval.sbuf = inpcommandname;
{
static char far tmp[] = {"Main comment"};
choices[2] = tmp;
}
paramvalues[2].type = 0x100+56;
paramvalues[2].uval.sbuf = inpcomment1;
{
static char far tmp[] = {"Second comment"};
choices[3] = tmp;
}
paramvalues[3].type = 0x100+56;;
paramvalues[3].uval.sbuf = inpcomment2;
numparms = 4;
if (gotrealdac && !reallyega) {
{
static char far tmp[] = {"Record colors?"};
choices[4] = tmp;
}
paramvalues[4].type = 0x100+13;
paramvalues[4].uval.sbuf = colorspec;
{
static char far tmp[] = {" (no | yes for full info | @filename to point to a map file)"};
choices[5] = tmp;
}
paramvalues[5].type = '*';
{
static char far tmp[] = {"# of colors"};
choices[6] = tmp;
}
paramvalues[6].type = 'i';
paramvalues[6].uval.ival = maxcolor;
{
static char far tmp[] = {" (if recording full color info)"};
choices[7] = tmp;
}
paramvalues[7].type = '*';